package com.hao.loadingpopupwindow;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.hao.base.BaseActiivty;
import com.hao.loading.LoadingUtils;

public class MainActivity extends BaseActiivty {

    private RelativeLayout mainView;
    private RelativeLayout testView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        mainView = (RelativeLayout) findViewById(R.id.main_view);
        testView = (RelativeLayout) findViewById(R.id.test_view);


        testView.addView(getLoadingUtils().getView());
        setListener();
    }


    //点击事件
    private void setListener() {
        getLoadingUtils().setOnAgainLoadingListenter(new LoadingUtils.onAgainLoadingListenter() {
            @Override
            public void againLoading() {
                //重新加载的方法

            }
        });
        findViewById(R.id.loding_bu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "加载", Toast.LENGTH_SHORT).show();
                getLoadingUtils().showLoading();
            }
        });
        findViewById(R.id.loding_failed_bu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "失败", Toast.LENGTH_SHORT).show();
                getLoadingUtils().showLoadingFailed();
            }
        });
        findViewById(R.id.loding_null_bu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "null", Toast.LENGTH_SHORT).show();
                getLoadingUtils().showLoadingNull();
            }
        });
    }

}
